﻿@model ExampleCustomEntityPageViewModel<BlogPostDisplayModel>
@inject ICofoundryTemplateHelper<ExampleCustomEntityPageViewModel<BlogPostDisplayModel>> Cofoundry

@{
    Cofoundry.Template.UseDescription("Template for the blog post details page");
    var post = Model.CustomEntity.Model;
}

<div class="container">

    <div class="row content-block">
        <div class="col-sm-12">
            <h1>@Model.PageTitle</h1>
        </div>
    </div>

    @(await Cofoundry.Template.CustomEntityRegion("Body")
        .AllowMultipleBlocks()
        .AllowBlockType<ContentSectionDataModel>()
        .AllowBlockType<ContentSplitSectionDataModel>()
        .EmptyContentMinHeight(500)
        .WrapWithTag("div", new{@class = "col-sm-8"})
        .InvokeAsync())

        <div class="col-sm-4">
            @if (!EnumerableHelper.IsNullOrEmpty(post.Categories))
            {
                <h3>Categories</h3>

                <ul class="list-group--alt">
                    @foreach (var category in post.Categories)
                {
                        <li><a href="/blog?categoryId=@category.CategoryId" title="@category.ShortDescription">@category.Title</a></li>
                    }
                </ul>
            }

            @(await Cofoundry.Template.Region("Page Templates")
                .AllowMultipleBlocks()
                .EmptyContentMinHeight(500)
                .InvokeAsync())

        </div>
    
</div>